define(function(require, exports, module) {
    var ALL = require("../common/all"),
        Md5 = require("../plugins/md5/md5"),
        CONFIG = ALL.CONFIG,
        METHOD = ALL.METHOD,
        Init = ALL.Init;


    var _vm = Init.initVue({
        data : {
            check: {},
            selected: false,
            user_name : "",
            password : ""
        },
        methods: {
            submit: function() {

                this.check.$valid();

                if (!this.check.flag) return;

                METHOD.loading.show();
                METHOD.ajax("admin/login", {
                    user_name : _vm.user_name,
                    password : Md5(_vm.password)
                }, {type:"post"}).done(function(json){
                    METHOD.loading.hide();
                    window.location.href = "collection/index.html";
                }).fail(function(){
                    METHOD.loading.hide();
                });
            }
        }
    });
});

